feat: filesystem store backend#251
Conversation
|
I just came into this PR because I implemented the store based on gorilla/sessions Is this PR (should fix #182) being considered? |
|
@geschke Please help to take a look build fails. |
|
Perhaps I misunderstood how the test file is meant to be applied. I attempted to run the tests locally, but encountered errors when using the commands specified in the This works fine when I run But it fails with the go test command in When I remove the Please provide guidance on how to proceed. Should I commit the mentioned changes? Unfortunately, I seem unable to run the tests in my GitHub repository; perhaps I've overlooked something here. Thanks in advance & |
|
Please resolve the conflicts. |
There was a problem hiding this comment.
Pull Request Overview
This pull request adds support for a filesystem store backend using the experimental Gorilla sessions FilesystemStore to enable session persistence for Gin applications.
- Introduces a new filesystem store module with its own NewStore and Options API.
- Provides comprehensive tests for session get/set, delete, flashes, clear, options, and multi-session handling.
- Updates the sample usage in the _example directory and enriches the README documentation with filesystem instructions.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| filesystem/filesystem_test.go | New tests for verifying the filesystem session functionality |
| filesystem/filesystem.go | New implementation wrapping Gorilla's FilesystemStore |
| _example/filesystem/main.go | Example code demonstrating how to use the filesystem backend |
| README.md | Documentation updated to include filesystem store usage |
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #251 +/- ##
===========================================
+ Coverage 64.00% 82.36% +18.36%
===========================================
Files 8 13 +5
Lines 75 431 +356
===========================================
+ Hits 48 355 +307
- Misses 25 59 +34
- Partials 2 17 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
When testing the sessions middleware, I realized that a filesystem store was missing, which is the default in PHP. Upon examining the underlying Gorilla sessions library, I discovered an experimental implementation of a filesystem store. Despite its experimental status, it performed well in my tests when integrated into a Gin application using pure Gorilla sessions.
To support the Gorilla FilesystemStore, I added the necessary code in a filesystem backend module, provided by this pull request.
While testing the filesystem module, I noticed discrepancies in the test files for the backend modules. For instance, the
cookie_test.gofile didn't work as expected - the function "NewStore()" was missing. After modifying it to "cookie.NewStore()" and importing the "gin-contrib/sessions/cookie" module, the test ran successfully with the command "go test cookie/cookie_test.go". I didn't make changes to another module in this pull request, since I'm not very experienced with the Golang test system. Please correct me if I'm mistaken.In the "
filesystem_test.go" file, which is essentially a modified copy of the cookie test, I used the function "filesystem.NewStore()", and the tests ran successfully in my environment. However, the test revealed an issue with theOptionssettings in the FilesystemStore of the Gorilla sessions module version 1.2.1, used in this library. This problem has been resolved in the current version, 1.2.2, so I updated the version number ingo.mod.I would appreciate it if you could merge this pull request, as I believe the addition of the filesystem store is valuable, particularly for development and testing purposes.
Thanks in advance &
Kind regards,
Ralf